/**
 * Copyright (c) 2015-2030 by Beijing Yanlight Co., Ltd.
 * All rights reserved.
 */
package com.yanlight.type;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author haolw
 * @time 2018/07/04
 */
public enum UserRootRole {
	SUPER_ADMIN(1),
	PARTNER_ADMIN(2),
	PARTNER_SUB(3)
	;
	private Integer type;
	private static final List<Integer> allowRoles = new ArrayList<Integer>();
	static {
		allowRoles.add(SUPER_ADMIN.type);
		allowRoles.add(PARTNER_ADMIN.type);
	}

	UserRootRole(Integer type) {
		this.setType(type);
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}
	
	public static boolean allowLogin(Integer root) {
		if (allowRoles.contains(root)) {
			return true;
		} else {
			return false;
		}
	}
	
}
